//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    banner:[]
  },
  callPhone:function(){
    wx.makePhoneCall({
      phoneNumber: '13983657517' 
    })
  },
  onLoad: function () {
    var that=this;
    wx.request({
      url: app.globalData.apiUrl+'/banner', //仅为示例，并非真实的接口地址
      data: {},
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        res.data.forEach(function(v,i){
          res.data[i].imgurl = app.globalData.resourceUrl + res.data[i].imgurl;
        })
        that.setData({
          banner: res.data
        });
      }
    });
    wx.request({
      url: app.globalData.apiUrl + '/major', //仅为示例，并非真实的接口地址
      data: {
        count:4
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        res.data.forEach(function (v, i) {
          res.data[i].mainimg = app.globalData.resourceUrl + res.data[i].mainimg;
        })
        that.setData({
          courseList: res.data
        });
      }
    })
  }
})
